Update 3:
> Now supports 32-color palletes. 32-color pallete graphic sets can only display the full color range on NeoLemmix; I will also release an updated CustLemmix to support them (while retaining classic mechanics).
> Now supports pixel-perfect trigger areas.

Update 2:
> Pallete matching now works from color 15 to color 0 instead of 0 to 15. This means, if you have a duplicate between your pallete and the default, it'll use your custom entry instead. This is important because DOS (but not Lemmix) will display default pallete terrain but will not regard it as solid.
> INI support improved.
> Added a new command, style_number.

Update 1:
> Added compression support, no need for an external compression tool anymore.



CREDITS:
Galleon - For QB64
SMcNeill - For coding assistance
ccexplore - For Lemmings format documentation and assistance with compression algorithm

LemSet created by Namida Verasche (aka Namida / Ninjamida / Hayan Ninja).
If you like this tool, show your thanks by using it to create awesome graphic sets and levels. =P




Styles to compile should consist of the following files in the same directory as the EXE:

[name].ini              	- Style info
[name]_tXX.bmp          	- Terrain graphics
[name]_oXX.bmp           	- Object graphics
[name]_pallete.bmp (optional) 	- Pallete

Where [name] is the same across all files. Enter this name when you run the program.
You can also do it from the command line: lemset.exe [name] (No quotes or brackets!)

If you run the program and simply press enter without entering a name, it will look for the following:

style.ini		- Style info
tXX.bmp			- Terrain graphics
oXX.bmp			- Object graphics
pallete.bmp (optional)	- Pallete


FORMATS:

BMP files should be saved as 24-bit uncompressed BMP files. The tool *should* be able to load any version of the BMP format, as long as it's 24-bit and uncompressed. It will NOT load BMPs that are compressed or 16-color/256-color. I'm also not sure how well it handles BMPs that are stored top-down.

Don't freak out too much about this - if you save your images in MS Paint using the "24-bit" option, they will be in the correct format for this tool.

Images may be any height, but the width must be divisible by 8. You can, of course, just add extra blank space to pad it to the correct size. Any color which is defined in the pallete will be rendered as-is, while colors which are not will be rendered as transparent. It should be noted that Lemmings only uses 18-bit color values, not 24-bit. Because of this, some colors which are slightly different in 24-bit will be exactly the same in 18-bit. The 18-bit values, not the 24-bit values, are used when matching pixels to the pallete.

Terrain pieces should be a single graphic for each piece.

Objects should contain all frames in one image, arranged vertically in order. Therefore, the size of this image should be [width] x [height * frames]. There should be NO gap between frames.

You can define the pallete either in the INI file or using a pallete.bmp file. If you're using a pallete.bmp file, it should be 16x1 or 32x1 (depending on the colors in the style you're creating), with each pixel representing one pallete entry.

Note that Lemmings will automatically override the first 7 colors of the pallete with default ones, and the 8th color with a duplicate of the 9th. Colors 9 through 16/32 may be chosen freely.

The INI file should be one value per line, with a format of [key]=[value], no quotes around the value even if it's text. It does not matter whether you include spaces on one (or both) sides of the equals sign or not. For example:

pallete_type=24
pallete_type =24
pallete_type= 24
pallete_type = 24

Any of these is acceptable.

The INI file must also have a line return at the end of the last line, otherwise the data on the last line will not be counted!

All types of line returns are supported - CF, LF, or CF+LF.
Lines that do not contain an = symbol are ignored by LemSet, so you can include comments as plain text simply by not having an = on the same line.
You no longer need to have a line break at the end of the file, and you can now have blank lines in your file.




INI File:

The INI file must contain:
- Pallete info
- Information on each object
- A style number (optional)

You do not need to enter any information about terrain pieces. This is because all of their information can be derived from the image files.

It does not matter what order the data in the INI file is in; it only matters that all of it is there. You can even mix and match different sections together, LemSet won't care.


1) Pallete info

The first setting under pallete_info is the pallete type. This can be set to one of three values:

pallete_info = 24            Uses 24-bit RGB values to define the pallete
pallete_info = 18            Uses 18-bit RGB values to define the pallete
pallete_info = bmp           Uses pallete.bmp to define the pallete

If pallete_info is set to bmp, the graphic set's pallete will be derived from pallete.bmp, and no further pallete information is needed in the INI file.

Otherwise, you will need to define each color. Define colors as follows:

pallete_# = R,G,B

Where R, G, B are the red, green and blue values of the color. If pallete_info is set to 24, you should enter values from 000 to 255. If pallete_info is set to 18, you should enter values from 00 to 63 (the same values that Lemmings itself uses). Note that you must pad the values with 0s - if you are using 24-bit values, all entries should be 3 digits; if you are using 18-bit values, all entries should be 2 digits.
In fact - no matter what format you use, the program converts it to 18-bit values before processing further. The other two methods are simply included for convenience.
Just like with defining keys, it does not matter how or where you put spaces.

You must also specify whether it's a 16-color pallete or a 32-color one, unless you are using a BMP:

pallete_colors = 32

Colors are numbered starting at zero. The Lemmings default pallete (note: this does not apply to Xmas/Holiday lemmings, only Lemmings/ONML/CustLemm) is:

pallete_info = 18
pallete_0 = 00,00,00
pallete_1 = 16,16,56
pallete_2 = 00,44,00
pallete_3 = 60,52,52
pallete_4 = 60,60,00
pallete_5 = 56,08,08
pallete_6 = 32,32,32
pallete_7 = 00,00,00

or

pallete_info = 24
pallete_0 = 000,000,000
pallete_1 = 064,064,224
pallete_2 = 000,176,000
pallete_3 = 240,208,208
pallete_4 = 240,240,000
pallete_5 = 224,032,032
pallete_6 = 128,128,128
pallete_7 = 000,000,000


The included defpal##.bmp files have the default pallete (and empty spaces) in the correct layout for pallete.bmp.


2) Object info

You must set the following values for each object. The values listed are the defaults if you do not set anything for a specific object.

object_#_frames = 0         Number of animation frames (starting from 1, not 0).
                            If this is set to zero, the slot will be assumed to be empty.
object_#_start_frame = 0    Frame number (starting from 0) to start animation from.
object_#_trigger_left = 0   X coordinate of trigger area. Range: -3 to (width - 1).
object_#_trigger_top = -4   Y coordinate of trigger area. Range: -7 to (height - 1).
object_#_trigger_width = 4  Width of trigger area. Range: 1 to 1024.
object_#_trigger_height = 4 Height of trigger area. Range: 1 to 1024.
object_#_trigger_type = 0   Effect of trigger area. See below for values.
object_#_preview_frame = 0  Frame number (starting from 0) to display on preview screen.
object_#_trigger_anim = 0   Sets triggered animation (otherwise, object will animate constantly).
object_#_trigger_sound = 0  Sets the sound effect played when the object is triggered. See below

Note that trigger coordinates and sizes should be divisible by 4 when creating styles for engines other than NeoLemmix. (CustLemmix does NOT support it.)

Also note that the window will overwrite several attributes:
  object_1_start_frame = 1
  object_1_preview_frame = 1
  object_1_trigger_anim = 1

Additionally, the window must be 48 pixels wide and at least 25 pixels tall. Frame #1 should not have anything visible below y=24. Frame #0 in a window animation should be the fully open window, frame #1 should be fully closed, with the remaining frames being the opening animation.

Each graphic set must contain at least two objects. For practical purposes this would be an exit and a window, but in fact, the first object may be anything - it does not have to be an exit. The second object, however, must be a window - and is the only object that can be a window.


TRIGGER EFFECT IDs:
0 - No effect
1 - Exit
2 - Turn lemmings left
3 - Turn lemmings right
4 - Trap
5 - Water
6 - Fire
7 - One Way Left
8 - One Way Right
9 - Steel
10 - No blocker area


(Note that 2, 3, 9 and 10 are not used by the official sets - they're used for technical purposes in the game, but objects are able to be assigned them. I've included them here for completeness. Defining an object to set a steel area is pointless - you can just use actual steel areas, unless you want to use it to set larger areas than the game usually allows for. However, you can probably come up with some creative uses for the turn lemmings left/right areas and no blocker areas.)


TRIGGER SOUND IDs:

(These are copied from ccexplore's documentation on GROUNDxO/VGAGRx format, with the numbers changed from hex to decimal)

0 = no sound
1 = skill select (the sound you get when you click on one of the skill icons at the bottom of the screen)
2 = entrance opening (sounds like "boing")
3 = level intro (the "let's go" sound)
4 = the sound you get when you assign a skill to lemming
5 = the "oh no" sound when a lemming is about to explode
6 = sound effect of the electrode trap and zap trap,
7 = sound effect of the rock squishing trap, pillar squishing trap, and spikes trap
8 = the "aargh" sound when the lemming fall down too far and splatters
9 = sound effect of the rope trap and slicer trap
10 = sound effect when a basher/miner/digger hits steel
11 = (not sure where used in game)
12 = sound effect of a lemming explosion
13 = sound effect of the spinning-trap-of-death, coal pits, and fire shooters (when a lemming touches the object and dies)
14 = sound effect of the 10-ton trap
15 = sound effect of the bear trap
16 = sound effect of a lemming exiting
17 = sound effect of a lemming dropping into water and drowning
18 = sound effect for the last 3 bricks a builder is laying down


3) Style number

The style number is optional and is a single line in the following format:

style_number = #

Where # is a number from 0 to 9.

If you enter a style number, LemSet will compile the style as ground#o.dat and vgagr#.dat, where # is the number you chose. If you do not enter one, it will compile the style to groundXo.dat and vgagrX.dat.




Other notes:
- The program will stop processing terrain or object data as soon as it encounters a non-existant piece. It won't check if there are more pieces after the gap. So for example, if you have t00.bmp, t01.bmp, t02.bmp and t04.bmp, it will stop after t02.bmp because it can't find t03.bmp, and move on to processing the objects.
- All data in the INI file is *NOT* case-sensitive.
- You *should* be able to compile styles that are in subfolders, simply by including a / when entering a name. EG: if your files are in the "tree" folder and named treestyle.ini, treestyle_t00.bmp, etc, you could enter "tree/treestyle" for the name. You cannot use the generic names (style.ini, t00.bmp, etc) in a subfolder. Also note that this is just my guess based on how the program is coded; the subfolder feature is neither intentional nor officially supported so if an error occurs when using a subfolder that doesn't occur if you don't use one, don't report it.